import TimerBaseCommand from './timerBaseCommand';

class DeleteTimerCommand extends TimerBaseCommand {
  static CMD = 0x08;  // 删除定时事件命令

  /**
   * 创建删除定时命令
   * @param {number} timerId - 要删除的定时器ID
   */
  static createCommand(timerId) {
    const data = new Uint8Array([timerId]);
    return this.packFrame(this.CMD, data);
  }

  /**
   * 解析删除定时响应
   * @param {Uint8Array} frame - 响应数据帧
   */
  static parseResponse(frame) {
    const parsed = this.parseBaseFrame(frame);
    if (!parsed || parsed.cmd !== this.CMD) return null;

    return {
      success: parsed.data[0] === 1
    };
  }
}

export default DeleteTimerCommand; 